<%-- 
    Document   : login
    Created on : Jul 2, 2011, 10:55:45 AM
    Author     : Tharindu
--%>

<%@page import="org.epid.reporter.util.UserUtil" %>
<%
boolean showLoginError = false;

if ( request.getParameter("btnLogin") != null ) {
    String login = request.getParameter("txtName");
    String password = request.getParameter("txtPass");

     if ( UserUtil.login(login, password) ){
         response.sendRedirect("AddDicease.jsp");
     } else {
        showLoginError = true;
    }
}
%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Login Page</title>
    </head>
    <body bgcolor="#FFFF00">
        <h1>Epidomic Reporter - Group ETA</h1>
        <br/><br/>
        <% if ( showLoginError ) { %>
        <span style="color: red" >Login failed. Please try again.</span>
        <% } %>
        <form action="login.jsp">
            <table>
                <tr>
                    <td> User name:</td>
                    <td><input type="text" name="txtName" value="" maxlength="90" /></td>
                </tr>
                <tr>
                    <td>Password :</td>
                    <td><input type="password" name="txtPass" value="" maxlength="90" /></td>
                </tr>
                <tr>
                    <td> &nbsp; </td>
                    <td><input type="submit" value="Submit" name="btnLogin" /> <input type="reset" value="Clear" /></td>
                </tr>
            </table>
        </form>
    </body>
</html>
